Skip to content

fix(plot): render non-finite samples as gaps instead of edge spikes - #476

Open
bluejay-creators wants to merge 1 commit into
tlecomte:masterfrom
bluejay-creators:fix/plot-nan-gaps
Open

bluejay-creators wants to merge 1 commit into
tlecomte:masterfrom
bluejay-creators:fix/plot-nan-gaps

Conversation

@bluejay-creators

Copy link
Copy Markdown

Following up on your comment in #330 that hiding zeroes and NaN in plots "is something that could be addressed".

PlotCurve draws a single GL line strip, and a line strip can't have gaps. So in the pitch tracker, every silence is drawn as a vertical line down to the bottom edge, then a flat line along it until the next note.

This PR:

  • PlotCurve draws independent line segments between consecutive finite points (DrawLines instead of DrawLineStrip), so non-finite samples become gaps. Curves with no NaN look the same as before.
  • Pitch tracker maps unvoiced frames and the zero-filled start of the buffer to NaN. Estimates outside the axis range become gaps instead of being clipped to the edge.

Before / after (three sung notes with rests in between, rendered from the same synthetic input):

Before

before

After

after

The other plots (for example long-time levels) could also use NaN for "no data" now. I've kept this PR to the pitch tracker so it stays small.

🤖 Generated with Claude Code

PlotCurve drew one GL line strip, which cannot contain gaps, so every
silence in the pitch tracker was drawn as a vertical line down to the
plot edge and a flat line along it. Draw independent segments between
consecutive finite points instead, so non-finite samples become gaps.

The pitch tracker now maps unvoiced frames and the zero-filled initial
buffer to NaN, and treats estimates outside the axis range as gaps
rather than clipping them to the edge. Silence is blank, and phrases
are separate strokes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant